import { defineStore } from "pinia";

export const useStore = defineStore("storeId", {
  state: () => {
    return {
      clickNum: 0,
      name: "tgrong",
      age: 18,
      work: "coder",
      isAdmin: true,
      likes: ["编程", "看书", "跑步"],
    };
  },
  getters: {
    clickNumPar() {
      return this.clickNum + 100;
    },
  },
  actions: {
    changeClickNum(val) {
      this.clickNum += val;
    },
    changeName(val) {
      this.name = val;
    },
    changLikes(opt) {
      this.likes[opt.idx] = opt.val;
    },
  },
  // persist: {
  //   enabled: true,
  //   strategies: [
  //     {
  //       storage: localStorage
  //     }
  //   ]
  // }
});
